home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 03 - 1987 / 03.04 Apr 87 / MPW macros / doShift < prev    next >
Encoding:
Text File  |  1987-03-09  |  1.7 KB  |  61 lines  |  [TEXT/MPS ]

  1. #    This moves a Rez DITL item by the amount requested in the direction asked.
  2. #    The cursor must be somewhere on the line containing the boundary Rectangle
  3. #    Frank Alviani - Monday, January 26, 1987 2:17:29 PM
  4.  
  5. set exit 0
  6. set dir "`request 'Direction <U>p|<D>own|<R>ight|<L>eft'`"
  7. exit if ({dir} == "") OR ({status} != 0)
  8. set amt "`request -d 10 'Amount to shift?'`"
  9. exit if ({amt} == "") OR ({status} != 0)
  10. find ¡0¡0 "{active}"    #ensure we're @ start of line
  11. if {dir} =~ /≈[Uu]≈/    #UP
  12.     begin
  13.     find /∂{/Δ:Δ/,/ "{active}"    #find top coord
  14.     set t `catenate "{active}".§`
  15.     set top `evaluate {t} - {amt}`
  16.     replace § {top} "{active}"
  17.     find /,[0-9]+,/Δ:Δ/,/ "{active}"    #find bottom coord
  18.     set t `catenate "{active}".§`
  19.     set top `evaluate {t} - {amt}`
  20.     replace § {top} "{active}"
  21.     exit
  22.     end
  23. end
  24. if {dir} =~ /≈[Dd]≈/    #DOWN
  25.     begin
  26.     find /∂{/Δ:Δ/,/ "{active}"    #find top coord
  27.     set t `catenate "{active}".§`
  28.     set top `evaluate {t} + {amt}`
  29.     replace § {top} "{active}"
  30.     find /,[0-9]+,/Δ:Δ/,/ "{active}"    #find bottom coord
  31.     set t `catenate "{active}".§`
  32.     set top `evaluate {t} + {amt}`
  33.     replace § {top} "{active}"
  34.     exit
  35.     end
  36. end
  37. if {dir} =~ /≈[Ll]≈/    #LEFT
  38.     begin
  39.     find /∂{[0-9]+,/Δ:Δ/,/ "{active}"    #find left coord
  40.     set t `catenate "{active}".§`
  41.     set top `evaluate {t} - {amt}`
  42.     replace § {top} "{active}"
  43.     find /,[0-9]+,/Δ:Δ/∂}/ "{active}"    #find right coord
  44.     set t `catenate "{active}".§`
  45.     set top `evaluate {t} - {amt}`
  46.     replace § {top} "{active}"
  47.     end
  48. end
  49. if {dir} =~ /≈[Rr]≈/    #RIGHT
  50.     begin
  51.     find /∂{[0-9]+,/Δ:Δ/,/ "{active}"    #find left coord
  52.     set t `catenate "{active}".§`
  53.     set top `evaluate {t} + {amt}`
  54.     replace § {top} "{active}"
  55.     find /,[0-9]+,/Δ:Δ/∂}/ "{active}"    #find right coord
  56.     set t `catenate "{active}".§`
  57.     set top `evaluate {t} + {amt}`
  58.     replace § {top} "{active}"
  59.     end
  60. end
  61.